package com.hdoit.apollo.logical.shop.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.hdoit.apollo.logical.shop.dao.ISupplyCargoDao;
import com.hdoit.apollo.logical.shop.mapper.SupplyCargoMapper;
import com.hdoit.apollo.logical.shop.model.SupplyCargo;
import com.tennetcn.data.dao.base.ISqlExpression;
import com.tennetcn.data.dao.base.impl.SuperDao;
import com.tennetcn.data.utils.SqlExpressionFactory;
/**
 * @author      humaoshu
 * @email       
 * @createtime  2018年05月22日 11:57:04
 * @comment
 */
@Component
public class SupplyCargoDaoImpl extends SuperDao<SupplyCargo> implements ISupplyCargoDao{

	@Autowired
	private SupplyCargoMapper supplyCargoMaper;
	
	@Override
	public List<SupplyCargo> queryListBySupplierId(String supplierId) {
		
		return supplyCargoMaper.queryListBySupplierId(supplierId);
	}

	@Override
	public boolean deleteSupplyCargoByKey(String key) {
		
		ISqlExpression sqlExpression = SqlExpressionFactory.createExpression();
		sqlExpression.addBody("delete from",SupplyCargo.class)
					.andWhere("id=#{key}")
					.setParam("key", key);
		return delete(sqlExpression)>=0;
	}

	@Override
	public SupplyCargo checkSupplyCargo(String supplierId, String cargoId, String collocationId) {
		return supplyCargoMaper.checkSupplyCargo(supplierId,cargoId,collocationId);
	}

}